home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 2109 / 2109.xpi / chrome / febe.jar / content / febeExtLists.js < prev    next >
Text File  |  2009-10-13  |  3KB  |  102 lines

  1. // author: Chuck Baker
  2. // contact: febe@customsoftwareconsult.com
  3. // Version 6.3
  4.  
  5. var febeNameGuidxref = {};
  6.  
  7. function febeBuildList(){
  8.     // Clear the list
  9.     var theList = document.getElementById("febeExtList");
  10.     var children = theList.childNodes;
  11.     var n = children.length;
  12.     // Clear existing items
  13.     for (var i = 0; i < n; i++) {
  14.         theList.removeChild(children[0]);
  15.     }//for
  16.     
  17.     febeGetExt();
  18.     
  19.     // Sort the list
  20.     var sortArray = [];
  21.     for(var i in febeExtensionsList){
  22.         sortArray.push(febeExtensionsList[i].Name);
  23.     }//for
  24.     sortArray.sort();
  25.     
  26.     for(var i in sortArray){
  27.         var data = febeExtensionsList[febeNameGuidxref[sortArray[i]]];
  28.         
  29.         var row = document.createElement('listitem');
  30.         
  31.         row.setAttribute('id', data.Guid );
  32.         row.setAttribute('type', "checkbox" );
  33.         row.setAttribute('label', data.Name+" - "+data.Version );
  34.         row.setAttribute('checked', "false" );
  35.         
  36.         theList.appendChild( row );
  37.  
  38.     }//for
  39.     document.getElementById("febeSelectAllID").setAttribute("disabled","false");
  40.     document.getElementById("febeDeselectAllID").setAttribute("disabled","false");
  41.     return true;
  42. }//febeBuListWindow()
  43.  
  44. function febeSelect(bool){
  45.   // Select/deselect all
  46.     for(var i in febeExtensionsList){
  47.         var item = document.getElementById(i);
  48.         if(item){item.setAttribute("checked",bool);}
  49.     }//for
  50. }//febeSelect()
  51.  
  52. function febeSaveList(){
  53.  
  54. }//febeSaveList()
  55.  
  56. function febeGetExt(){
  57.   //Get a list of all installed extensions/themes
  58.     var allExt = Application.extensions.all;
  59.     
  60.     febeProfDir = Components.classes["@mozilla.org/file/directory_service;1"]
  61.         .getService(Components.interfaces.nsIProperties)
  62.         .get("ProfD", Components.interfaces.nsIFile);
  63.     febeProfDir.append("extensions");
  64.     var extDir = febeProfDir.clone();
  65.     febeExtensionsList = {};
  66.  
  67.     for(var i in allExt){
  68.         var guid = allExt[i].id
  69.         var thisExt = new febeExtInfo(guid);
  70.         var eType = thisExt.type;                            // 2=Extension, 4=Theme
  71.         if(eType != 2 && eType != 4){continue;}            // Not an extension or theme ... what is it?
  72.         
  73.         var ext = new febeExtObj;
  74.         ext.Name = thisExt.name;
  75.         ext.Version = thisExt.version;
  76.         ext.Icon = thisExt.iconURL; 
  77.         ext.Home = thisExt.homepageURL; 
  78.         ext.Guid = guid; 
  79.         ext.verified = false;
  80.         ext.Include = false;
  81.         
  82.         var ePath = extDir.clone();
  83.         ePath.append(thisExt.guid)
  84.         ext.Path = ePath.path; 
  85.         
  86.         febeExtensionsList[guid] = ext;
  87.         febeNameGuidxref[thisExt.name] = guid; 
  88.         
  89.         var tmp = "";
  90.         tmp=febeExtensionsList[thisExt.guid].Name+"\n";
  91.         tmp+=febeExtensionsList[thisExt.guid].Version+"\n";
  92.         tmp+=febeExtensionsList[thisExt.guid].Path+"\n";
  93.         tmp+=febeExtensionsList[thisExt.guid].Icon+"\n";
  94.         tmp+=febeExtensionsList[thisExt.guid].Home+"\n";
  95.         tmp+=febeExtensionsList[thisExt.guid].Guid+"\n";
  96.         tmp+=febeExtensionsList[thisExt.guid].verified+"\n";
  97.         tmp+=febeExtensionsList[thisExt.guid].Include+"\n";
  98.         tmp+="type: "+eType+"\n";
  99.         tmp+=i;
  100.         if(i < 3) alert(tmp);
  101.     }//for
  102. }//febeGetExt()